window.onload = function() {
  show = document.getElementById("showButton");
  back = document.getElementById("back");
  missedButton = document.getElementById("missed");
  hardButton = document.getElementById("hard");
  soSoButton = document.getElementById("soSo");
  easyButton = document.getElementById("easy");


  showButton.onclick = function() {
    back.style.display = "block";
  }

  // Submit responses to each card
  missedButton.onclick = function() {
    var form = document.createElement('form');
    form.setAttribute('method', 'post');
    form.setAttribute('action', '/missed');
    form.style.display = 'hidden';
    document.body.appendChild(form);
    form.submit();
  }

  hardButton.onclick = function() {
    var form = document.createElement('form');
    form.setAttribute('method','post');
    form.setAttribute('action','/hard');
    form.style.display = 'hidden';
    document.body.appendChild(form);
    form.submit();
  }

  soSoButton.onclick = function() {
    var form = document.createElement('form');
    form.setAttribute('method','post');
    form.setAttribute('action','/soSo');
    form.style.display = 'hidden';
    document.body.appendChild(form);
    form.submit();
  }

  easyButton.onclick = function() {
    var form = document.createElement('form');
    form.setAttribute('method','post');
    form.setAttribute('action','/easy');
    form.style.display = 'hidden';
    document.body.appendChild(form);
    form.submit();
  }

}
